import * as actionTypes from '../actions/ActionTypes';

import { handleActions } from 'redux-actions';

//邮箱注册
const defData = {
    msg: {},
    isloading: true//是否读取ing1
}
export const AddemailReducer = handleActions({
    [actionTypes.ADDEMAIL]: {
        next(state, action) {
            return { ret: true, data: action.payload };
        },
        throw(state, action) {
            return { ret: false, statusText: "报错", data: defData };
        }
    },[actionTypes.SELEMAIL]: {
        next(state, action) {
            return { ret: true, data: action.payload };
        },
        throw(state, action) {
            return { ret: false, statusText: "报错", data: defData };
        }
    }
}, { ret: true, statusText: '默认', data: defData });

//手机注册
const defData1 = {
    msg: {},
    isloading: true//是否读取ing1
}
export const AddphoneReducer = handleActions({
    [actionTypes.ADDPHONE]: {
        next(state, action) {
            return { ret: true, data: action.payload };
        },
        throw(state, action) {
            return { ret: false, statusText: "报错", data: defData1 };
        }
    },[actionTypes.SELPHONE]: {
        next(state, action) {
            return { ret: true, data: action.payload };
        },
        throw(state, action) {
            return { ret: false, statusText: "报错", data: defData1 };
        }
    }
}, { ret: true, statusText: '默认', data: defData1 });